<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateVillagerTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('villager', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('project_id')->default(0)->comment('项目id');
            $table->integer('protocol_id')->index()->default(0)->comment('协议id');
            $table->integer('grid_id')->default(0)->comment('网格id');
            $table->string('name', 100)->comment('姓名');
            $table->string('identity_card', 100)->comment('身份证号');
            $table->integer('id_obverse_img')->nullable()->comment('身份证正面');
            $table->integer('id_reverse_img')->nullable()->comment('身份证反面');
            $table->string('phone', 60)->comment('手机号');
            $table->string('addr', 60)->default('')->comment('地址');
            $table->integer('type')->default(0)->comment('0:主权利人1:普通权利人');
            $table->integer('is_late')->default(0)->comment('0:未故1:已故');
            $table->timestamps();
            $table->softDeletes();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `villager` comment '村民表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('villager');
    }
}
